<?php 
/*
 *  Theme function for zenchat.module
 */

/*
 * hook_theme
 */
function zenchat_theme($existing, $type, $theme, $path) {
  return array(
    'users_block' => array(
      'arguments' => array('items')
    )
  );
}

/*
 *  list users in block
 */
function theme_users_block($items, $title = '') {
	global $user;
	$content  .= '<div class="item-list"><h3>' . $title . '</h3><ul>';
  if (empty($items)) {
    $content .= '<li id="zenchat-user-empty"><em>'. t('There are no active users.') .'</em></li>';
  }
  else {
 
    foreach ($items as $i) {
      if($i->name != $user->name) {
      $content .= '<li id="zenchat-user">'
      				. '<a href="javascript:void(0)" onclick="javascript:chatWith(\'' .  addslashes($i->name) . '\')">'
      				. $i->name 
      				.'</li></a>';
      } else {
      	      $content .= '<li id="zenchat-user">'
      				. $i->name 
      				.'</li>';
      }
    }
  }
  $content .= '</ul></div>';

  return $content;
}
